<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="Restoring Namespaces or Datasets">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="kubernetes_CSI_00043.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect Appliance 1.5.0-1.6.0 Help Center">
<meta name="DC.Publisher" content="20241029">
<meta name="prodname" content="csbs">
<meta name="documenttype" content="usermanual">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="kubernetes_CSI_00046">
<meta name="DC.Language" content="en-us">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>Restoring Namespaces or Datasets</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="kubernetes_CSI_00046"></a><a name="kubernetes_CSI_00046"></a>

<h1 class="topictitle1">Restoring Namespaces or Datasets</h1>
<div><p>This section describes how to restore a namespace or dataset that has been backed up to the original location or a new location.</p>
<div class="section"><h4 class="sectiontitle">Context</h4><p>The <span>OceanProtect</span> supports data restoration using backup copies, reverse replication copies, archive copies (archive copies of replication copies cannot be used for restoration to the original location), and replication copies (data cannot be restored to the original location). Data can be restored to the original location or a new location.</p>
<ul><li>Restoration to the original location<p>Data can be restored to the following original locations:</p>
<ul><li>Restores the PVC copy data of the namespace to the namespace where the PVC copy resides.</li><li>Restores the PVC copy data of the dataset to the dataset where the PVC copy resides.</li></ul>
</li><li>Restoration to a new location<p>Data can be restored to the following new locations:</p>
<ul><li>Restores the PVC copy data of the namespace to the namespace of the target cluster.</li><li>Restores the PVC copy data of the dataset to the dataset of the target cluster.</li></ul>
</li></ul>
</div>
<div class="section"><h4 class="sectiontitle">Prerequisites</h4><ul><li>Before restoring a resource copy that has been backed up to the resources of another Kubernetes cluster, you need to register the Kubernetes cluster with the <span>OceanProtect</span>. For details, see <a href="kubernetes_CSI_00011.html">Step 3: Registering a Cluster</a>.</li><li>Before restoration, ensure that the remaining space of the data directory at the target location for restoration is greater than the size of the copy used for restoration before reduction. Otherwise, restoration will fail.</li><li>For OpenShift, before restoring MySQL to a new location, run the following command on the cluster node to add the service account of the workload to <strong>anyuid</strong>:<pre class="screen">oc adm policy add-scc-to-user anyuid system:serviceaccount:<em>Namespace name</em>:<em>Service account name</em></pre>
</li></ul>
</div>
<div class="section"><h4 class="sectiontitle">Precautions</h4><ul><li>If services in the original pod are normal, cross-pod restoration will cause startup failure of services in the target pod. You are advised to perform cross-pod restoration when the original pod is faulty.</li><li>In the dataset restoration scenario, ensure that the selected backup resources are complete.</li></ul>
</div>
<div class="section"><h4 class="sectiontitle">Procedure</h4><ol><li id="kubernetes_CSI_00046__li0198134611381"><span>Choose <span class="uicontrol" id="kubernetes_CSI_00046__kubernetes_csi_00042_en-us_topic_0000001839142377_uicontrol17790342165415"><b><span id="kubernetes_CSI_00046__kubernetes_csi_00042_en-us_topic_0000001839142377_text679084235415"><strong>Explore</strong></span> &gt; <span id="kubernetes_CSI_00046__kubernetes_csi_00042_en-us_topic_0000001839142377_text14790942175410"><strong>Copy Data</strong></span> &gt; <span id="kubernetes_CSI_00046__kubernetes_csi_00042_en-us_topic_0000001839142377_text42195499217"><strong>Containers</strong></span> &gt; <span id="kubernetes_CSI_00046__kubernetes_csi_00042_en-us_topic_0000001839142377_text729816765515"><strong>Kubernetes CSI</strong></span></b></span>.</span></li><li><span>Search for copies by resource or copy. This section describes how to search for copies by resource.</span><p><p>On the <span><strong>Resources</strong></span> tab page, locate the namespace or dataset to be restored based on the table name and click the namespace or dataset name. (The following uses restoring a namespace as an example.)</p>
</p></li><li><span>On the <span class="uicontrol"><b><span><strong>Copy Data</strong></span></b></span> page, select the year, month, and day in sequence to locate the copy.</span><p><p>If <span><img src="en-us_image_0000001839180553.png"></span> is displayed below a month or day, a copy is generated in the month or on the day.</p>
</p></li><li><span>Find the copy to be restored and choose <span><strong>More</strong></span> &gt; <span><strong>Restore</strong></span> on the right.</span></li><li><span>Restore data to the original location or a new location.</span><p><ul><li>Restoration to the original location<p><a href="#kubernetes_CSI_00046__table52750616234">Table 1</a> describes the related parameters.</p>

<div class="tablenoborder"><a name="kubernetes_CSI_00046__table52750616234"></a><a name="table52750616234"></a><table cellpadding="4" cellspacing="0" summary="" id="kubernetes_CSI_00046__table52750616234" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters for restoring data to the original location</caption><colgroup><col style="width:29.87%"><col style="width:70.13000000000001%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="29.87%" id="mcps1.3.5.2.5.2.1.1.2.2.3.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70.13000000000001%" id="mcps1.3.5.2.5.2.1.1.2.2.3.1.2"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="29.87%" headers="mcps1.3.5.2.5.2.1.1.2.2.3.1.1 "><p><span><strong>Overwrite Rule</strong></span></p>
</td>
<td class="cellrowborder" valign="top" width="70.13000000000001%" headers="mcps1.3.5.2.5.2.1.1.2.2.3.1.2 "><p>If the copy and the PVCs in the target location have the same file, you need to replace or ignore the existing file. Overwrite rules can be set only for PVC data.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li>Restoration to a new location<div class="p"><a href="#kubernetes_CSI_00046__table15668141795417">Table 2</a> describes the related parameters.
<div class="tablenoborder"><a name="kubernetes_CSI_00046__table15668141795417"></a><a name="table15668141795417"></a><table cellpadding="4" cellspacing="0" summary="" id="kubernetes_CSI_00046__table15668141795417" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameters for restoring data to a new location</caption><colgroup><col style="width:29.87%"><col style="width:70.13000000000001%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="29.87%" id="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70.13000000000001%" id="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.2"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="29.87%" headers="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.1 "><p><span><strong>Target Cluster</strong></span></p>
</td>
<td class="cellrowborder" valign="top" width="70.13000000000001%" headers="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.2 "><p>Select the cluster to which the backup copy is restored.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="29.87%" headers="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.1 "><p><span><strong>Namespace</strong></span></p>
</td>
<td class="cellrowborder" valign="top" width="70.13000000000001%" headers="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.2 "><p>Select the namespace to which the backup copy is restored.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="29.87%" headers="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.1 "><p><span><strong>Overwrite Rule</strong></span></p>
</td>
<td class="cellrowborder" valign="top" width="70.13000000000001%" headers="mcps1.3.5.2.5.2.1.2.1.2.2.3.1.2 "><p>If the copy and the PVCs in the target location have the same file, you need to replace or ignore the existing file. Overwrite rules can be set only for PVC data.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</li></ul>
</p></li><li><span>(Optional) click <span><strong>Modify Environment Variables</strong></span> in <span><strong>Advanced</strong></span> to configure environment variable parameters so that the restoration target location (including the original location) has the same properties as the configured environment variables. <a href="#kubernetes_CSI_00046__table1612824872219">Table 3</a> describes parameters related to modification.</span><p>
<div class="tablenoborder"><a name="kubernetes_CSI_00046__table1612824872219"></a><a name="table1612824872219"></a><table cellpadding="4" cellspacing="0" summary="" id="kubernetes_CSI_00046__table1612824872219" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Environment variables modification</caption><colgroup><col style="width:50%"><col style="width:50%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.2.6.2.1.2.3.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.2.6.2.1.2.3.1.2"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.1 "><p><strong>Workload Type</strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.2 "><p>Workload type to be configured in the environment variables of the restoration target location. The types are as follows:</p>
<ul><li>DaemonSets: Used to ensure that only one pod instance runs on all or some nodes. When a node is added to a cluster, a new pod is also added for the workload.</li><li>Deployment: Refers to workloads that do not store any data or status during running.</li><li>ReplicaSets: Used to ensure the availability of a specified number of identical pods.</li><li>StatefulSet: Refers to workloads that store data or status during running.</li><li>Jobs: Refers to short-lived jobs which run at a time and can be executed immediately after being deployed.</li><li>CronJob: Refers to short-lived jobs which run periodically at specified times. For example, you can perform time synchronization for all running nodes at the specified time point.</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.1 "><p><strong>Workload Name</strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.2 "><p>Workload name to be configured in the environment variables of the target location. This parameter corresponds to the <strong>name</strong> property value of the <strong>metadata</strong> field in the YAML file of the workload.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.1 "><p><strong>Container Name</strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.2 "><p>Container name to be configured in the environment variable of the target location. This parameter corresponds to the <strong>name</strong> property value in the <strong>containers</strong> field under <strong>spec &gt; template &gt; spec</strong> in the YAML file of the workload.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.1 "><p><strong>Environment Variables</strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.6.2.1.2.3.1.2 "><p>Environment variable information to be configured for the target location. Multiple environment variables can be added. The entered information corresponds to the information about the <strong>env</strong> field under <strong>spec &gt; template &gt; spec &gt; containers</strong> in the YAML file of the workload. The entered <strong>key</strong> and <strong>value</strong> correspond to <strong>name</strong> and <strong>value</strong> of the field, respectively.</p>
</td>
</tr>
</tbody>
</table>
</div>
</p></li><li><span>(Optional) For 1.6.0 and later versions, enable <span class="uicontrol"><b>Modify StorageClass Parameters</b></span>. If you want to restore a StorageClass in the copy to a new location, you can use this option to configure the parameters of the StorageClass to be restored. Set the parameters listed in <a href="#kubernetes_CSI_00046__table14504479371">Table 4</a>.</span><p>
<div class="tablenoborder"><a name="kubernetes_CSI_00046__table14504479371"></a><a name="table14504479371"></a><table cellpadding="4" cellspacing="0" summary="" id="kubernetes_CSI_00046__table14504479371" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Description for modifying StorageClass parameters</caption><colgroup><col style="width:12.44%"><col style="width:68.13%"><col style="width:19.42%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="12.44124412441244%" id="mcps1.3.5.2.7.2.1.2.4.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="68.13681368136814%" id="mcps1.3.5.2.7.2.1.2.4.1.2"><p>Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.421942194219426%" id="mcps1.3.5.2.7.2.1.2.4.1.3"><p>Example</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="12.44124412441244%" headers="mcps1.3.5.2.7.2.1.2.4.1.1 "><p>StorageClass Name</p>
</td>
<td class="cellrowborder" valign="top" width="68.13681368136814%" headers="mcps1.3.5.2.7.2.1.2.4.1.2 "><p>StorageClass name of the original Kubernetes cluster.</p>
</td>
<td class="cellrowborder" valign="top" width="19.421942194219426%" headers="mcps1.3.5.2.7.2.1.2.4.1.3 "><p>sc-nas</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="12.44124412441244%" headers="mcps1.3.5.2.7.2.1.2.4.1.1 "><p>Parameter</p>
</td>
<td class="cellrowborder" valign="top" width="68.13681368136814%" headers="mcps1.3.5.2.7.2.1.2.4.1.2 "><p>Parameter value of the StorageClass. You can click <strong>Add</strong> to add multiple parameter attributes. Perform the following steps to obtain parameter information through the CLI:</p>
<ul><li>For FusionCompute or CCE, run the <strong>kubectl get sc</strong> command on the background page of the cluster to view the StorageClass name. Run the <strong>kubectl get sc </strong><em>StorageClass name</em><strong> -oyaml</strong> command again to view the YAML information about the StorageClass, where the <strong>parameters</strong> field indicates the parameter value.</li><li>For OpenShift, run the <strong>oc get sc</strong> command on the background page of the cluster to view the StorageClass name. Run the <strong>oc get sc </strong><em>StorageClass name</em><strong> -oyaml</strong> command again to view the YAML information about the StorageClass, where the <strong>parameters</strong> field indicates the parameter value.</li></ul>
</td>
<td class="cellrowborder" valign="top" width="19.421942194219426%" headers="mcps1.3.5.2.7.2.1.2.4.1.3 "><p>key=backend</p>
<p>value=storage-1</p>
<p></p>
</td>
</tr>
</tbody>
</table>
</div>
</p></li><li><span>Click <span class="uicontrol"><b><span><strong>OK</strong></span></b></span>.</span></li><li><span>Confirm the high-risk information and click <span class="uicontrol"><b><span><strong>OK</strong></span></b></span>.</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="kubernetes_CSI_00043.html">Restoration</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">Copyright &copy; Huawei Technologies Co., Ltd.</div></body>
</html>